package com.education.platform.api.pay.wxpay;

import com.github.wxpay.sdk.WXPayConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.io.InputStream;

/**
 * 微信支付配置
 */
public class WxPayConfig implements WXPayConfig {

    /**
     * 应用id
     */
    public static final String APP_ID = "wx6fbdcec7e3a2555f";
    /**
     * 密钥
     */
    public static final String KEY = "Cff986b7ddbb2846485e6a0f9f497628";
    /**
     * 等于parnerid，商户号
     */
    public static final String MCH_ID = "1601394079";
    /**
     * 服务器ip
     */
    public static final String SPBILL_CREATE_IP = "39.106.1.151";
    /**
     * 回调地址
     */
    //正式
    public static  String NOTIFY_URL = "http://39.106.1.151:8020/api/pay/wxCallBack";
    //测试
//    public static final String NOTIFY_URL = "http://39.106.1.151:7020/api/pay/wxCallBack";
    /**
     * app支付 固定
     */
    public static final String TRADE_TYPE_APP = "APP";

    public WxPayConfig(){}

    @Override
    public String getAppID() {
        return APP_ID;
    }


    @Override
    public String getMchID() {
        return MCH_ID;
    }

    @Override
    public String getKey() {
        return KEY;
    }

    /**
     * 统一下单接口  和  支付回调接口都不用证书
     * @return
     */
    @Override
    public InputStream getCertStream() {
        return null;
    }

    /**
     * 链接超时  6s
     * @return
     */
    @Override
    public int getHttpConnectTimeoutMs() {
        return 6000;
    }
    /**
     * 读取超时  10s
     * @return
     */
    @Override
    public int getHttpReadTimeoutMs() {
        return 10000;
    }


//    @Value("${notify.wx-url}")
//    public  void setNotifyUrl(String notifyUrl) {
//        NOTIFY_URL = notifyUrl;
//    }
}
